﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsAwareFlagsArray : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsAwareFlagsArray(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsAwareFlagsArray obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsAwareFlagsArray()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsAwareFlagsArray(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGsAwareFlagsArray() : this(GlobalsPINVOKE.new_OdGsAwareFlagsArray(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setChildrenUpToDate(bool childrenUpToDate, uint nVpID)
		{
			GlobalsPINVOKE.OdGsAwareFlagsArray_setChildrenUpToDate(this.swigCPtr, childrenUpToDate, nVpID);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool childrenUpToDate(uint nVpID)
		{
			bool result = GlobalsPINVOKE.OdGsAwareFlagsArray_childrenUpToDate(this.swigCPtr, nVpID);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public uint get(uint nVpID)
		{
			uint result = GlobalsPINVOKE.OdGsAwareFlagsArray_get(this.swigCPtr, nVpID);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void set(uint nVpID, uint flags)
		{
			GlobalsPINVOKE.OdGsAwareFlagsArray_set(this.swigCPtr, nVpID, flags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void clear()
		{
			GlobalsPINVOKE.OdGsAwareFlagsArray_clear(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isEmpty()
		{
			bool result = GlobalsPINVOKE.OdGsAwareFlagsArray_isEmpty(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public uint numAwareFlags()
		{
			uint result = GlobalsPINVOKE.OdGsAwareFlagsArray_numAwareFlags(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool areInvalid(uint nVpID)
		{
			bool result = GlobalsPINVOKE.OdGsAwareFlagsArray_areInvalid(this.swigCPtr, nVpID);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
